﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;

public partial class inc_LoadHtml : System.Web.UI.UserControl
{
    protected string headstr = "";
    private string url = "";

    public string Url
    {
        get { return url; }
        set { url = value; }
    }

    public int isFoot = 0;

    protected void Page_Load(object sender, EventArgs e)
    {
        /*if (Cache[url] != null)
        {
            headstr = Cache[url].ToString();
        }
        else
        {
            StringManage sm = new StringManage();
            Stream oStr = sm.getWebRequest(url);
            StreamReader sr = new StreamReader(oStr, System.Text.Encoding.Default);
            headstr = sr.ReadToEnd();
            oStr.Close();

            Cache.Insert(url, headstr, null, DateTime.Now.AddHours(1), TimeSpan.Zero);
        }
        if (url.IndexOf("inc08_foot") > 0) 
        {
            isFoot = 1;
        }*/

        /**2010-08-17  头部尾部落地**/
        if (url.IndexOf("inc08_head.html") != -1)
            headstr = loadhead();
        else if (url.IndexOf("inc08_foot.html") != -1)
            headstr = loadfoot();
        /**2010-08-17**/
    }

    private static string loadhead()
    {
        StringBuilder result = new StringBuilder();
        result.Append("<!--主导航-->");
        result.Append("<div id=\"head08\">");
        result.Append("<div id=\"sta_top1\" class=\"top\">");
        result.Append("<ul>");
        result.Append("<li>·<a href=\"http://my.stockstar.com\" target=\"_blank\">我的证券之星</a></li>");
        result.Append("<li>[<a href=\"http://member.stockstar.com/login/log_in.aspx\" target=\"_blank\">登录</a>]</li>");
        result.Append("<li>[<a href=\"http://member.stockstar.com/login/regist.aspx\" target=\"_blank\">快速注册</a>]</li>");
        result.Append("<li>·<a href=\"http://ezine.stockstar.com/\" target=\"_blank\"><span style=\"color:#C00\">邮件订阅</span></a></li>");
        result.Append("<li>·<a href=\"http://news.stockstar.com/rss/\" target=\"_blank\"><span style=\"color:#C00\">RSS订阅</span></a></li>");
        result.Append("<li><div class=\"top_icon\"></div></li>");
        result.Append("<li><a href=\"#\" onclick=\"this.style.behavior='url(#default#homepage)';this.setHomePage(top.location.href);\" target=\"_self\">设为首页</a></li>");
        result.Append("<li><div class=\"top_icon\"></div></li>");
        result.Append("<li><a href=\"javascript:window.external.addFavorite(top.location.href,document.title)\" target=\"_self\">收藏本页</a></li>");
        result.Append("</ul>");
        result.Append("</div>");
        result.Append("<div class=\"clear\"></div>");
        result.Append("</div>");
        result.Append("<div id=\"head\">");
        result.Append("<div class=\"logo\"><a href=\"http://www.stockstar.com\"><img src=\"http://i.ssimg.cn/images/public/logo.gif\" width=\"160\" height=\"62\" alt=\"证券之星\" /></a></div>");
        result.Append("<div class=\"menu1\">");
        result.Append("<ul>");
        result.Append("<li class=\"first\"><a href=\"http://stock.stockstar.com\" target=\"_blank\">股票</a></li>");
        result.Append("<li><a href=\"http://quote.stockstar.com\" target=\"_blank\">行情</a></li>");
        result.Append("<li><a href=\"http://resource.stockstar.com\" target=\"_blank\">数据</a></li>");
        result.Append("<li><a href=\"http://stock.stockstar.com/report/\" target=\"_blank\">研报</a></li>");
        result.Append("<li><a href=\"http://quote.stockstar.com/stock/QuoteComment.htm\" target=\"_blank\">股评</a></li>");
        result.Append("<li><a href=\"http://hk.stockstar.com\" target=\"_blank\">港股</a></li>");
        result.Append("<li><a href=\"http://ipo.stockstar.com\" target=\"_blank\">新股</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://gem.stockstar.com\" target=\"_blank\">创业板</a></li>");
        result.Append("<li class=\"first\"><a href=\"http://money.stockstar.com\" target=\"_blank\">理财</a></li>");
        result.Append("<li><a href=\"http://fund.stockstar.com\" target=\"_blank\">基金</a></li>");
        result.Append("<li><a href=\"http://bond.stockstar.com\" target=\"_blank\">债券</a></li>");
        result.Append("<li><a href=\"http://bank.stockstar.com\" target=\"_blank\">银行</a></li>");
        result.Append("<li><a href=\"http://forex.stockstar.com\" target=\"_blank\">外汇</a></li>");
        result.Append("<li><a href=\"http://gold.stockstar.com\" target=\"_blank\">黄金</a></li>");
        result.Append("<li><a href=\"http://if.stockstar.com\" target=\"_blank\">期指</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://futures.stockstar.com\" target=\"_blank\">期货</a></li>");
        result.Append("</ul>");
        result.Append("</div>");
        result.Append("<div class=\"menu2\">");

        result.Append("<ul>");
        result.Append("<li class=\"first\"><a href=\"http://finance.stockstar.com/\">财经</a></li>");
        result.Append("<li><a href=\"http://finance.stockstar.com/list/headlines.htm\">要闻</a></li>");
        result.Append("<li><a href=\"http://finance.stockstar.com/list/policy.htm\">政策</a></li>");
        result.Append("<li><a href=\"http://finance.stockstar.com/list/opinion.htm\">观点</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://finance.stockstar.com/finance/mediacenter.htm\">媒体</a></li>");
        result.Append("<li class=\"first\"><a href=\"http://www.stockstar.com/ganniu/\" target=\"_blank\">赶牛</a></li>");
        result.Append("<li><a href=\"http://blog.stockstar.com\" target=\"_blank\">博客</a></li>");
        result.Append("<li><a href=\"http://bar.stockstar.com\" target=\"_blank\">股吧</a></li>");
        result.Append("<li><a href=\"http://www.ganniu.com/chinaindex\" target=\"_blank\">解盘</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://ask.stockstar.com/\" target=\"_blank\">问股</a></li>");
        result.Append("</ul>");

        result.Append("</div>");
        result.Append("<div class=\"menu3\">");
        result.Append("<ul>");
        result.Append("<li class=\"first\"><a href=\"http://school.stockstar.com\" target=\"_blank\">特色</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://school.stockstar.com\" target=\"_blank\">学堂</a></li>");
        result.Append("<li><a href=\"http://survey.stockstar.com\" target=\"_blank\">调查</a></li>");
        result.Append("<li><a href=\"http://smart.stockstar.com/\" target=\"_blank\">选股</a></li>");
        result.Append("<li><a href=\"http://quote.stockstar.com/stock/external_special.htm\" target=\"_blank\">雷达</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://fund.stockstar.com/pool/zcg.htm\" target=\"_blank\">股票池</a></li>");

        result.Append("<li class=\"first\"><a href=\"http://sales.stockstar.com/\" target=\"_blank\">商城</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://sales.stockstar.com/zone/sale2007/sms/list_sms.asp\" target=\"_blank\">短信</a></li>");
        result.Append("<li><a href=\"http://download.stockstar.com\" target=\"_blank\">下载</a></li>");
        result.Append("<li><a href=\"http://win.stockstar.com\" target=\"_blank\">大赛</a></li>");
        result.Append("<li><a href=\"http://sales.stockstar.com/zone/sale2007/pay_note.asp\" target=\"_blank\">支付</a></li>");
        result.Append("<li class=\"third\"><a href=\"http://3g.stockstar.com\" target=\"_blank\">手机版</a></li>");
        result.Append("</ul>");
        result.Append("</div>");
        result.Append("<div class=\"clear\"></div>");
        result.Append("</div>");
        result.Append("<!--主导航 end-->");        
        return result.ToString();
    }

    private static string loadfoot()
    {
        StringBuilder result = new StringBuilder();
        result.Append("<div id=\"foot08\">");
        result.Append("<div><a href=\"http://www.stockstar.com/nav/map.html\" target=\"_blank\">网站导航</a> | <a href=\"http://info.stockstar.com/aboutus\" target=\"_blank\">公司简介</a> | <a href=\"http://info.stockstar.com/aboutus/Partners.htm\" target=\"_blank\">合作伙伴</a> | <a href=\"http://www.stockstar.com/intro/disclaimer.asp\" target=\"_blank\">免责条款</a> | <a href=\"http://info.stockstar.com/aboutus/us.htm\" target=\"_blank\">诚聘英才</a> | <a href=\"http://info.stockstar.com/aboutus/in.htm\" target=\"_blank\">征稿启事</a> | <a href=\"http://win2.stockstar.com/\" target=\"_blank\">炒股大赛</a> | <a href=\"http://member.stockstar.com/service/kefu/\" target=\"_blank\">客服中心</a> | <a href=\"http://info.stockstar.com/aboutus/lx.htm\" target=\"_blank\">联系我们</a> | <a href=\"http://info.stockstar.com/aboutus/lx.htm#ad\" target=\"_blank\">广告服务</a> | <a href=\"http://member.stockstar.com/message/message.html\" target=\"_blank\">用户反馈</a></div>");
        result.Append("<div>欢迎访问证券之星！请<a href=\"http://info.stockstar.com/aboutus/lx.htm\" target=\"_blank\">点此</a>与我们联系 版权所有：Copyright &copy; 1996-" + DateTime.Now.Year + "年 </div>");
        result.Append("</div>");
        result.Append("<!--站点计数-->");
        result.Append("<!--WebTCode Start-->");
        result.Append("<script type=\"text/javascript\" src=\"http://www.stockstar.com/wt/SS_dcs_tag.js\"></script>");
        result.AppendLine("<!--WebTCode End-->");
        //result.Append("<script type=\"text/javascript\" src=\"http://news.stockstar.com/info/js/ggword.js\"></script>");
        result.AppendLine("<script type=\"text/javascript\">");
		result.AppendLine("var _gaq = _gaq || [];");
		result.AppendLine("_gaq.push(['_setAccount', 'UA-15599747-1']);");
		result.AppendLine(" _gaq.push(['_setDomainName', '.stockstar.com']);");
		result.AppendLine(" _gaq.push(['_setAllowHash', false]);");
		result.AppendLine(" _gaq.push(['_trackPageview']);");
		result.AppendLine("(function() {");
		result.AppendLine("var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;");
		result.AppendLine("ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';");
		result.AppendLine("var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);");
		result.AppendLine("})();");
		result.AppendLine("</script>");
        result.Append("<script type=\"text/javascript\" src=\"http://img.stockstar.com/material/material.ashx?pageid=fund&ads=ad_778_60|ad_215_60\"></script>");
        return result.ToString();
    }
}
